//
//  MeatOrderDetailCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/19.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "MeatOrderDetailCell.h"

@implementation MeatOrderDetailCell

#pragma mark - lifecycle methods
- (void)setupUI
{
    [self addSubview:self.titleLab1];
    [self addSubview:self.titleLab2];
    [self addSubview:self.titleLab3];
    [self addSubview:self.detailLab1];
    [self addSubview:self.detailLab2];
    [self addSubview:self.detailLab3];
    [self addSubview:self.copyLab];

}

- (void)setupLayout
{
    {
        _titleLab1.size = CGSizeMake(100, 35);
        _titleLab1.mj_x = 15;
        _titleLab1.mj_y = 0;
    }
    
    {
        _titleLab2.size = CGSizeMake(100, 35);
        _titleLab2.mj_x = 15;
        _titleLab2.mj_y = _titleLab1.bottom;
    }
    
    {
        _titleLab3.size = CGSizeMake(100, 38);
        _titleLab3.mj_x = 15;
        _titleLab3.mj_y = _titleLab2.bottom;
    }
    
    {
        _detailLab1.size = CGSizeMake(200, 35);
        _detailLab1.mj_y = 0;
        _detailLab1.mj_x = KScreenWidth - 45 - _detailLab2.width;
    }
    
    {
        _detailLab2.size = CGSizeMake(200, 35);
        _detailLab2.mj_y = _detailLab1.bottom;
        _detailLab2.mj_x = KScreenWidth - 45 - _detailLab2.width;

    }
    
    {
        _detailLab3.size = CGSizeMake(200, 38);
        _detailLab3.mj_y = _detailLab2.bottom;
        _detailLab3.mj_x = KScreenWidth - 45 - _detailLab3.width;
    }
    
    {
        _copyLab.size = CGSizeMake(40, 16);
        _copyLab.mj_y = (35 - _copyLab.height)/2.0;
        _copyLab.mj_x = KScreenWidth - 45 - _copyLab.width;
    }
    
    {
        
    }
}

#pragma mark - setter methods

- (void)setType:(MeatOrderDetailCellType)type{
    
    switch (type) {
        case MeatOrderDetailCellType_Source:
            {
                _titleLab1.text = @"订单编号：";
                _titleLab2.text = @"下单时间：";
                _titleLab3.text = @"支付方式：";
                
                _detailLab1.text = @"749237593652322";
                _detailLab2.text = @"2019.06.13 12:35";
                _detailLab3.text = @"微信支付";
                
                _detailLab3.hidden = NO;
                _copyLab.hidden = NO;
                _detailLab1.mj_x = KScreenWidth - 90 - _detailLab1.width;
                
                _titleLab1.textColor = UIColorFromRGB(0x666666);
                _titleLab2.textColor = UIColorFromRGB(0x666666);
                _titleLab3.textColor = UIColorFromRGB(0x666666);
                
                _detailLab1.font = _detailLab2.font = mFont(13);


            }
            break;
            
        case MeatOrderDetailCellType_Settlement:
            {
                _titleLab1.text = @"商品金额";
                _titleLab2.text = @"运费";
                
                _detailLab1.text = @"¥976.23";
                _detailLab2.text = @"+¥0.01";
                _detailLab3.text = @"实付金额：¥ 976.23";
                
                _titleLab3.hidden = YES;
                _copyLab.hidden = YES;
                _detailLab1.mj_x = KScreenWidth - 45 - _detailLab1.width;
                
                
                _titleLab1.textColor = UIColorFromRGB(0x454545);
                _titleLab2.textColor = UIColorFromRGB(0x454545);

                _detailLab1.font = _detailLab2.font = mFont(12);
                
            }
            break;
            
        default:
            break;
    }
}

#pragma mark - getter methods

- (UILabel *)titleLab1{
    
    if (!_titleLab1) {
        _titleLab1 = [UILabel new];
        _titleLab1.font = mFont(13);
        
    }
    return _titleLab1;
}

- (UILabel *)titleLab2{
    
    if (!_titleLab2) {
        _titleLab2 = [UILabel new];
        _titleLab2.font = mFont(13);

    }
    return _titleLab2;
}

- (UILabel *)titleLab3{
    
    if (!_titleLab3) {
        _titleLab3 = [UILabel new];
        _titleLab3.font = mFont(13);

    }
    return _titleLab3;
}

- (UILabel *)detailLab1{
    
    if (!_detailLab1) {
        _detailLab1 = [UILabel new];
        _detailLab1.textColor = UIColorFromRGB(0x454545);
        _detailLab1.textAlignment = 2;

    }
    return _detailLab1;
}

- (UILabel *)detailLab2{
    
    if (!_detailLab2) {
        _detailLab2 = [UILabel new];
        _detailLab2.textColor = UIColorFromRGB(0x454545);
        _detailLab2.textAlignment = 2;

    }
    return _detailLab2;
}

- (UILabel *)detailLab3{
    
    if (!_detailLab3) {
        _detailLab3 = [UILabel new];
        _detailLab3.textColor = UIColorFromRGB(0x454545);
        _detailLab3.textAlignment = 2;
        _detailLab3.font = mFont(13);

    }
    return _detailLab3;
}


- (UILabel *)copyLab{
    
    if (!_copyLab) {
        _copyLab = [UILabel makeLabelWithText:@"复制" textColor:UIColorFromRGB(0x666666) font:mFont(11) textAliment:1];
        [self addShadowAndCircleCorner:_copyLab.layer corner:8];
        _copyLab.backgroundColor = mBackgroudColor;
    }
    return _copyLab;
}


@end
